package me.zd.tool.hardlink.view.i18n;

import me.zd.tool.hardlink.service.I18nService;
import me.zd.tool.hardlink.view.I18nAdapter;

import javax.swing.*;

public class I18nResetLabelAdapter implements I18nAdapter {
    private final JLabel component;
    private int index;

    public I18nResetLabelAdapter(JLabel component) {
        this.component = component;
    }

    @Override
    public void updateI18n() {
        if (index == 0) {
            component.setText("");
        } else {
            component.setText(I18nService.INS.format("reset.setting.countdown", index));
        }
    }

    @Override
    public void updateI18n(int index) {
        this.index = index;
        updateI18n();
    }
}
